<template>
  <div id="app">
    <div
      id="log"
      style="position: absolute;left: 100px;top: 100px;width: 1700px;height: 390px;font-size: 30px;color: red;line-height: 30px;z-index: 999999;word-wrap:break-word;"
    ></div>

    <router-view v-show="$store.state.appShow" v-if="isRouterAlive"/>

    <video
      :width="$store.state.vedioInfo.width"
      :height="$store.state.vedioInfo.height"
      style="position:absolute;visibility:hidden;"
      :style="{left: $store.state.vedioInfo.offsetLeft,top: $store.state.vedioInfo.offsetTop}"
    >
      Your browser does
      not
      support the video tag.
    </video>
  </div>
</template>

<script>
  export default {
    name: "App",
    provide() {
      return {
        reload: this.reload
      };
    },
    data() {
      return {
        hs: this.$store.state.hs,
        bridge: this.$store.state.bridge,
        isRouterAlive: true
      };
    },
    methods: {
      reload() {
        this.$store.commit("initHs");
        this.isRouterAlive = false;
        this.$nextTick(function () {
          this.isRouterAlive = true;
        });
      }
    },
    created() {
      // 获取信息
      let school = this.$store.getters.school;
      let user = this.$store.getters.user;

      // 预防, 退出页面关闭视频
      window.unload = function () {
        this.$store.state.bridge.closeVedio();
      };

      //  初始化hs的返回调用brid的返回处理
      this.hs.memoryO.goBack = ()=>{
        this.bridge.leavePage()
      }

    },
    mounted() {
      // console.log('app --- mounted')
    },
    beforeDestroy(){
      // console.log('app --- beforeDestroy')
    }
  };

</script>

<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-appearance: none;
    border: none;
    outline: none;
  }

  #app {
    font-family: "Avenir", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 1920px;
    height: 1080px;
    overflow: hidden;
  }
</style>
